package com.zxl.grocery.microservice.auth.server.configuration;

import com.zxl.grocery.microservice.auth.server.interceptor.ClientTokenInterceptor;
import feign.auth.BasicAuthRequestInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by zxl on 2017/10/13 0013.
 */
@Configuration
public class FeignConfiguration {
    @Bean
    ClientTokenInterceptor getClientTokenInterceptor(){
        return new ClientTokenInterceptor();
    }

    /**
     * @Author: Lzx
     * @Description: 如果连接其他服务需要提供用户名 密码，则在这里配置，比如Eureka服务器进行身份验证，在此配置用户名和密码
     * @Params:  * @param null
     * @Date: 21:24 2017/11/6
     */
   /* @Bean
    public BasicAuthRequestInterceptor basicAuthRequestInterceptor(){
        return new BasicAuthRequestInterceptor("user","password123");
    }*/

   /**
    * @Author: Lzx
    * @Description: 禁用单个FegionClient的Hystrix的支持，要在每个客户端加上该端代码
    * feign.hystrix.enabled: false ## 是禁用全局的feign对hystrix的支持
    * @Params:  * @param null
    * @Date: 21:34 2017/11/6
    */
   /* @Bean
    @Scope("prototype")
    public Feign.Builder feignBuilder() {
        return Feign.builder();
    }*/
}
